#!/usr/bin/env python
# encoding: utf-8
"""
document.py

Created by 刘 智勇 on 2011-06-25.
Copyright (c) 2011 __MyCompanyName__. All rights reserved.
"""

from datetime import datetime
import logging
import re

from mongokit import Document, IS
from tornadomongodb.configure import DB_CON, DB_NAME

class IdDoc(Document):
    __collection__ = 'ids'
    __database__ = DB_NAME

    structure = {
                '_id':unicode,
                'id':int,
    }
    use_schemaless = True
    use_dot_notation=True


class UserDoc(Document):
    __collection__ = 'people'
    __database__ = DB_NAME

    structure = {
            'email':unicode,
            'nick': unicode,
            'passwd':unicode,
            'created':datetime,
            'uid':unicode,
            'sina_id':unicode,
            'added':dict,
            'added_id':unicode,
            'counter':{unicode:int},
            'stacker':{unicode:list},
    }
    required_fields = ['created']
    default_values = {'created':datetime.utcnow}
    
    use_schemaless = True
    use_dot_notation=True
    